﻿using Microsoft.EntityFrameworkCore;

namespace BlazorLearn.Shared.Data;
public class ApplicationDbContext : DbContext
{
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseInMemoryDatabase("db");
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<User>().HasData(new User
        {
            Name = "张三",
            Phone = "16587845124",
            Email = "san.zhang@qq.com"
        },
        new User
        {
            Name = "李四",
            Phone = "17855698451",
            Email = "si.li@qq.com"
        },
        new User
        {
            Name = "王五",
            Phone = "18698455587",
            Email = "wu.wang@qq.com"
        });
    }

    public DbSet<User> Users { get; set; }
}
